#!/usr/bin/perl -w
use 5.010;

$_="He's out bowling with Barney tonight.";
s/Barney/Fred/;
print "$_\n";
s/with (\w+)/against $1's team/;
print "$_\n";
$_="green scaly dinosaur";
s/(\w+) (\w+)/$2, $1/;
say;
s/^/huge,/;
say;
s/,.*een//;
say;
s/green/red/;
say;
s/\w+$/($`!)$&/;
say;
s/\s+(!\W+)/$1/;
say;
s/huge/gigantic/;
say;

$_="fred flintstone";
if(s/fred/wilma/){
	print "Successfully replaced fred with wilma!\n";
}